"""
https://stackoverflow.com/questions/231767/what-does-the-yield-keyword-do
"""

xgener = (x**2 for x in range(5))
for i in xgener:
    print(i, end=', ')
print()
for i in xgener:  # ATTENTION Cannot iterate on generator for 2nd time
    print(i, end=', ')
print()


def x_try_yield(xg):
    for i in xg:
        yield i


for i in x_try_yield((x**3 for x in range(5))):
    print(i, end=', ')
print()
